We have an internal application that reads from the oncall API to calculate individual employee hours oncall for any given week. It has been working really well until recently, for a particular oncall schedule, the API returns the same entries multiple times in the array. I cannot find anything abnormal about the schedule when looking at it via the UI.
The actual query that recreates this:
https://api.pagerduty.com/oncalls?schedule_ids[]=PYKR1EK&escalation_policy_ids[]=PP7IQUY&time_zone=UTC&since=2020-11-02T00:00:00.000Z&until=2020-11-09T00:00:00.000Z
The results look like this, modified for easy reading and to protect names.
{
“oncalls”: [
{
“escalation_policy”: { “id”: “PP7IQUY” },
“escalation_level”: 1,
“schedule”: { “id”: “PYKR1EK” },
“user”: { “id”: “PAPHCIN” },
“start”: “2020-10-26T04:00:00Z”,
“end”: “2020-11-02T05:00:00Z”
},
{
“escalation_policy”: { “id”: “PP7IQUY” },
“escalation_level”: 1,
“schedule”: { “id”: “PYKR1EK” },
“user”: { “id”: “P2J8RKT” },
“start”: “2020-11-02T05:00:00Z”,
“end”: “2020-11-02T19:00:00Z”
},
{
“escalation_policy”: { “id”: “PP7IQUY” },
“escalation_level”: 1,
“schedule”: { “id”: “PYKR1EK” },
“user”: { “id”: “P2J8RKT” },
“start”: “2020-11-02T05:00:00Z”,
“end”: “2020-11-02T19:00:00Z”
},
{
“escalation_policy”: { “id”: “PP7IQUY” },
“escalation_level”: 1,
“schedule”: { “id”: “PYKR1EK” },
“user”: { “id”: “P2J8RKT” },
“start”: “2020-11-02T05:00:00Z”,
“end”: “2020-11-02T19:00:00Z”
},
{
“escalation_policy”: { “id”: “PP7IQUY” },
“escalation_level”: 1,
“schedule”: { “id”: “PYKR1EK” },
“user”: { “id”: “P2J8RKT” },
“start”: “2020-11-02T05:00:00Z”,
“end”: “2020-11-02T19:00:00Z”
},
{
“escalation_policy”: { “id”: “PP7IQUY” },
“escalation_level”: 1,
“schedule”: { “id”: “PYKR1EK” },
“user”: { “id”: “P2J8RKT” },
“start”: “2020-11-02T05:00:00Z”,
“end”: “2020-11-02T19:00:00Z”
},
{
“escalation_policy”: { “id”: “PP7IQUY” },
“escalation_level”: 1,
“schedule”: { “id”: “PYKR1EK” },
“user”: { “id”: “P6HB37Q” },
“start”: “2020-11-02T19:00:00Z”,
“end”: “2020-11-02T22:00:00Z”
},
{
“escalation_policy”: { “id”: “PP7IQUY” },
“escalation_level”: 1,
“schedule”: { “id”: “PYKR1EK” },
“user”: { “id”: “P6HB37Q” },
“start”: “2020-11-02T19:00:00Z”,
“end”: “2020-11-02T22:00:00Z”
},
{
“escalation_policy”: { “id”: “PP7IQUY” },
“escalation_level”: 1,
“schedule”: { “id”: “PYKR1EK” },
“user”: { “id”: “P6HB37Q” },
“start”: “2020-11-02T19:00:00Z”,
“end”: “2020-11-02T22:00:00Z”
},
{
“escalation_policy”: { “id”: “PP7IQUY” },
“escalation_level”: 1,
“schedule”: { “id”: “PYKR1EK” },
“user”: { “id”: “P6HB37Q” },
“start”: “2020-11-02T19:00:00Z”,
“end”: “2020-11-02T22:00:00Z”
},
{
“escalation_policy”: { “id”: “PP7IQUY” },
“escalation_level”: 1,
“schedule”: { “id”: “PYKR1EK” },
“user”: { “id”: “P6HB37Q” },
“start”: “2020-11-02T19:00:00Z”,
“end”: “2020-11-02T22:00:00Z”
},
{
“escalation_policy”: { “id”: “PP7IQUY” },
“escalation_level”: 1,
“schedule”: { “id”: “PYKR1EK” },
“user”: { “id”: “P2J8RKT” },
“start”: “2020-11-02T22:00:00Z”,
“end”: “2020-11-09T05:00:00Z”
},
{
“escalation_policy”: { “id”: “PP7IQUY” },
“escalation_level”: 1,
“schedule”: { “id”: “PYKR1EK” },
“user”: { “id”: “P2J8RKT” },
“start”: “2020-11-02T22:00:00Z”,
“end”: “2020-11-09T05:00:00Z”
},
{
“escalation_policy”: { “id”: “PP7IQUY” },
“escalation_level”: 1,
“schedule”: { “id”: “PYKR1EK” },
“user”: { “id”: “P2J8RKT” },
“start”: “2020-11-02T22:00:00Z”,
“end”: “2020-11-09T05:00:00Z”
},
{
“escalation_policy”: { “id”: “PP7IQUY” },
“escalation_level”: 1,
“schedule”: { “id”: “PYKR1EK” },
“user”: { “id”: “P2J8RKT” },
“start”: “2020-11-02T22:00:00Z”,
“end”: “2020-11-09T05:00:00Z”
},
{
“escalation_policy”: { “id”: “PP7IQUY” },
“escalation_level”: 1,
“schedule”: { “id”: “PYKR1EK” },
“user”: { “id”: “P2J8RKT” },
“start”: “2020-11-02T22:00:00Z”,
“end”: “2020-11-09T05:00:00Z”
}
],
“limit”: 25,
“offset”: 0,
“more”: false,
“total”: null
}